Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clr_match tactic #19

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

clr_match tactic #19

wants to merge 1 commit into from

Conversation

jkopanski
Copy link
Collaborator

Often times my goal looks like this:

(match
  match multifill ["dataSlot"]
    (match
      match
        match
          match
	    Ok evm Inhabited.default🇪⟦mstore evm (OfNat.ofNat 0) account.val.cast⟧🇪⟦state_prep⟧🇪⟦res.2⟧⟦"key"↦key⟧⟦"slot"↦slot⟧⟦"_1"↦account.val.cast⟧ with
          | Ok evm store => ...
          | s => s with
        | Ok evm store => ...
        | s => s with
      | Ok evm store => ...
      | s => s with
    | Ok evm store => ...
    | s => s
...)

which can't simplify becasue Ok is wrapped in insert or setEvm functions. This tactic will move those under the Ok in order to progress matches and then try to reclaim the inserts.

Often times my goal looks like this:

```
(match
  match multifill ["dataSlot"]
    (match
      match
        match
          match
	    Ok evm Inhabited.default🇪⟦mstore evm (OfNat.ofNat 0) account.val.cast⟧🇪⟦state_prep⟧🇪⟦res.2⟧⟦"key"↦key⟧⟦"slot"↦slot⟧⟦"_1"↦account.val.cast⟧ with
          | Ok evm store => ...
          | s => s with
        | Ok evm store => ...
        | s => s with
      | Ok evm store => ...
      | s => s with
    | Ok evm store => ...
    | s => s
...)
```

which can't simplify becasue `Ok` is wrapped in `insert` or `setEvm`
functions.  This tactic will move those under the `Ok` in order to
progress matches and then try to reclaim the inserts.
@Coda-Coda
Copy link
Collaborator

Hi @jkopanski, what would be an example place to use this?

@jkopanski
Copy link
Collaborator Author

Ah, I've forgot to push yesterday. See this commit: 9df1fda

In the balance/allowance case it seems that clr_varstore leaves unfolded State.insert and there is no EVMState modifications so there is already top level Ok constructor for state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants